home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / utl-0199 / anifmt.txt next >
Text File  |  1987-04-22  |  5KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                          CAD-3D Animation file format
  8.  
  9.                                  by Tom Hudson
  10.  
  11.  
  12.  
  13.          This document is intended to give interested persons the
  14.          ability to generate or read the animation data files used by
  15.          the CAD-3D solid-modeling program.  The animation files were
  16.          created to be as compact as possible, while including all the
  17.          information necessary to animate a wireframe or solid object
  18.          quickly.
  19.  
  20.                                   The Files.
  21.  
  22.          Each CAD-3D animation file is resolution-specific to run in
  23.          either monochrome or low-resolution mode.  The coordinates
  24.          are set to the appropriate resolution at the time of writing
  25.          to reduce processing done by the animation program.  The
  26.          normal way to use a CAD-3D animation file is to read the
  27.          entire file into a single RAM data structure and then use
  28.          pointers to scan through the data, plotting the objects to
  29.          the screen.
  30.  
  31.          The animation file structure is useful for other
  32.          applications, as well.  Since the animation images are stored
  33.          as "frames", each frame can be processed as an independent
  34.          image, and output to a printer or plotter for later use.  The
  35.          nice thing about this capability is that the user could
  36.          record a number of images in the animation file and run them
  37.          all off onto a printer in a single operation later, with the
  38.          computer automatically advancing the paper after each image
  39.          is printed.
  40.  
  41.          Each image in the animation file is termed a "frame".  Within
  42.          each frame is a list of faces or line segments that is to be
  43.          plotted to reconstruct the 3-D object.  For solid objects
  44.          (with hidden faces removed), these faces are furnished in
  45.          order from the farthest face to the nearest face and plotted
  46.          in this order.  In this way, the subsequent face plots erase
  47.          the faces that are behind the face being plotted.
  48.  
  49.          Each line segment or face in a frame is plotted until a
  50.          "frame" flag is found, at which time the program advances to
  51.          the next frame, sheet of paper, etc.
  52.  
  53.          The file is structured as follows:
  54.  
  55.          WORD -- Animation resolution (0 -- 16-color low-res or 2 --
  56.          monochrome)
  57.  
  58.          WORD -- Animation mode (0 -- Wireframe, 1 -- Hidden, 2 --
  59.          Solid, 3 -- Outlined)
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.          16 WORDS -- Color palette for the animation sequence
  73.  
  74.          The remainder of the file is a structure that gives data for
  75.          the various triangular faces in the image.  The structure
  76.          repeats until the count flag is <= 0.  If the flag is zero,
  77.          there are no more faces to draw in the current frame, and you
  78.          can show the frame just drawn.  The next group of faces
  79.          should be plotted on another screen in memory.  When that
  80.          frame is drawn, it is shown and plotting begins on the
  81.          original screen.  This repeats until the flag is -1,
  82.          indicating the end of the animation file.
  83.  
  84.          BYTE -- Count flag, has the following values:
  85.  
  86.              0: New frame.  Clear screen and reread the count flag.
  87.  
  88.                           -1: End of animation file.
  89.  
  90.                           >0: A normal face to draw.
  91.  
  92.          BYTE -- Face color and line segment flags.  Low nybble
  93.          contains color to use for drawing the face in color modes or
  94.          0-15 for shading level in monochrome.  High nybble contains
  95.          the line segment draw flags.  Bit 6 tells whether the first
  96.          line segment is drawn, bit 5 tells whether the second line
  97.          segment is drawn, and bit 4 tells whether the third line
  98.          segment is drawn.
  99.  
  100.          In animation modes 1, 2 and 3, there are two WORDs at this
  101.          point, the polygon minimum Y and maximum Y values for using
  102.          line A to plot the polygons.  The first is POLYMINY, the
  103.          second is POLYMAXY.  These values let you avoid having to
  104.          find the minimum and maximum Y values yourself.  These values
  105.          are not needed in wireframe mode and are not present.
  106.  
  107.          Now come the Vertices for the object, stored as eight WORDS
  108.          as follows:
  109.  
  110.                                    VERTEX1 X
  111.                                    VERTEX1 Y
  112.                                    VERTEX2 X
  113.                                    VERTEX2 Y
  114.                                    VERTEX3 X
  115.                                    VERTEX3 Y
  116.                                    VERTEX1 X
  117.                                    VERTEX1 Y
  118.  
  119.          The first line segment is VERTEX1-VERTEX2, the second line
  120.          segment is VERTEX2-VERTEX3, and the third line segment is
  121.          VERTEX3-VERTEX1.
  122.  
  123.          For wireframe objects, the last two points are unnecessary,
  124.          but for solid objects, you can simply point to the first
  125.          value and execute the polygon fill operation.  The last two
  126.          values close the polygon by joining the last point to the
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.          first.
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. əəəəəəəəəəəəəəəəəəəəəəəə